package com.learn.autoconfigure;

import com.learn.connection.MyHelper;
import com.learn.connection.MyHelperImpl;
import com.learn.properties.MyProperties;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Configuration：标记为配置类，使@Bean生效
 * @EnableConfigurationProperties：加载配置文件类
 * @ConditionalOnClass：条件注解
 */
@Configuration
@EnableConfigurationProperties({MyProperties.class})
@ConditionalOnClass({MyHelper.class})
public class MyAutoConfiguration {
    @Bean
    public MyHelper idbHelper() {
        return new MyHelperImpl();
    }
}
